package com.example.gobang.mapper;

import com.example.gobang.model.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * Description:
 * Date: 2024-09-04
 * Time: 8:28
 */
@Mapper
public interface UserMapper {
    @Insert("insert into user(user_id,user_name,password,score,total_count,win_count) " +
            "values(null,#{userName},#{password},1000,0,0)")
    void insert(UserInfo userInfo);

    @Select("select user_id,user_name,password,score,total_count,win_count from user " +
            "where user_name = #{userName}")
    UserInfo selectByName(String userName);

    void userWin(Integer userId);

    void userLose(Integer userId);
}
